import requests

#   test

# 后台登陆, 此处有bug, 登陆时验证码未做校验

s = requests.session()
base_url = 'http://192.168.4.210'

# s.get(base_url + '/TinyShop_v1.7/index.php?con=admin&act=captcha&h=40&w=120&bc=3f4657&c=ffffff')

# 登陆
url = base_url + '/TinyShop_v1.7/index.php?con=admin&act=check'
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
datas = 'name=admin&password=123456'
r = s.post(url, data=datas, headers=headers, allow_redirects=True)
print(r.text)

# if '退出' in r.text:
#     print('登陆成功')
# else:
#     print('登陆失败')
